<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<title>添加站内信信息</title>
<link th:replace="common/header"/>
</head>
<body class="no-skin">
	<div th:replace="common/top"/>
	<div class="main-container ace-save-state" id="main-container">
		<div th:replace="common/menu"/>
		<div class="main-content">
			<div class="main-content-inner">
				<div th:replace="common/title"/>
				<div class="page-content">
					<div th:replace="common/skin"/>
					<div class="row">
						<div class="col-xs-12">
							<!-- PAGE CONTENT BEGINS -->
							<form class="form-horizontal" action="add.do" name="form" th:action="@{/innerMail/add}" th:method="post" th:object="${innerMail}">
								<h3 class="header smaller lighter blue"><i class="fa fa-plus" aria-hidden="true"></i>添加站内信信息</h3>
								<div class="row-fluid">
								<!--PAGE CONTENT BEGINS HERE-->
									<div class="span6">
										<div class="control-group">
											<label class="control-label" for="title">标题:<font style="color:red">*</font></label>
											<div class="controls">
												<input type="text" name="title" id="title" class="input_fix" placeholder="标题" th:value="*{title}" maxlength="50"/>
											</div>
										</div>
									</div>
									<div class="span6">
										<font style="color:red"><p th:if="${#fields.hasErrors('title')}" th:errors="*{title}" >Name Error</p>&nbsp;</font>
									</div>
								</div>
								<div class="row-fluid">
								<!--PAGE CONTENT BEGINS HERE-->
									<div class="span6">
										<div class="control-group">
											<label class="control-label" for="content">内容:<font style="color:red">*</font></label>
											<div class="controls">
												<textarea name="content" id="content" class="input_fix" placeholder="内容" th:value="*{content}"/>
											</div>
										</div>
									</div>
									<div class="span6">
										<font style="color:red"><p th:if="${#fields.hasErrors('content')}" th:errors="*{content}" >Name Error</p>&nbsp;</font>
									</div>
								</div>
								<div class="row-fluid">
								<!--PAGE CONTENT BEGINS HERE-->
									<div class="span6">
										<div class="control-group">
											<label class="control-label" for="type">站内信类型:<font style="color:red">*</font></label>
											<div class="controls">
												<select th:field="*{type}" id="type" name="type" class="input_fix" th:value="*{type}" th:onchange="'selectType(this.value)'">
													<option value="">--请选择--</option>
													<option th:each="type : ${T(xyz.ibenben.zhongdian.system.entity.enums.MailTypeEnum).values()}" th:value="${type}" th:text="${type.text}"></option>
												</select>
											</div>
										</div>
									</div>
									<div class="span6">
										<font style="color:red"><p th:if="${#fields.hasErrors('type')}" th:errors="*{type}" >Name Error</p>&nbsp;</font>
									</div>
								</div>
								<div class="row-fluid" id="formUser">
								<!--PAGE CONTENT BEGINS HERE-->
									<div class="span6">
										<div class="control-group">
											<label class="control-label" for="toId">接受者:<font style="color:red">*</font></label>
											<div class="controls">
												<select th:field="*{toId}" id="toId" name="toId" class="input_fix">
													<option th:each="user : ${userList}"
														th:value="${user.id}" th:text="${user.username}">123</option>
												</select>
											</div>
										</div>
									</div>
									<div class="span6">
										<font style="color:red"><p th:if="${#fields.hasErrors('toId')}" th:errors="*{toId}" >Name Error</p>&nbsp;</font>
									</div>
								</div>
								<div class="row-fluid">
									<div class="text-center span12">
										<button shiro:hasPermission="/innerMail/add" class="btn btn-primary" type="submit"><i class="fa fa-floppy-o" aria-hidden="true"></i>提交</button>
										<button shiro:hasPermission="/innerMail/add" class="btn btn-danger" type="reset"><i class="fa fa-times" aria-hidden="true"></i>取消</button>
										<a shiro:hasPermission="/innerMail/getall" class="btn" href="getall" th:href="@{/innerMail/getall}"><i class="fa fa-reply" aria-hidden="true"></i>返回</a>
									</div>
								</div>
							</form>
							<!-- PAGE CONTENT ENDS -->
						</div><!-- /.col -->
					</div><!-- /.row -->
				</div><!-- /.page-content -->
			</div>
		</div><!-- /.main-content -->
		<div th:replace="common/footer"/>
	</div><!-- /.main-container -->
	<div th:replace="common/buttom"/>

	<script type="text/javascript">
		$("form").submit(function(){  
			$(":submit",this).attr("disabled","disabled");  
		}); 
		function selectType(value){
			console.log(value);
			if(value == "BackNotice" || value == "FrontNotice"){
				$("#formUser").hide();
			}else{
				$("#formUser").show();
			}
		}
	</script>
</body>
</html>
